Compiler Design
Q1.
Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end includes phases that are independent of the target hardware. S2: The back-end includes phases that are specific to the target hardware. S3: The back-end includes phases that are specific to the programming language used in the source code. Identify the CORRECT option.Q2.
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?Q4.
Consider the expression ( a-1)* (((b + c) / 3) + d)) . Let X be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture in which (i) only loads and store instructions can have memory operands and (ii) arithmetic instructions can have only register or immediate operands. The value of X is _________.Q5.
Which of the following is a type of a out-of-order execution, with the reordering done by a compilerQ6.
Consider the productions A\rightarrow PQ and A\rightarrow XY. Each of the five non-terminals A,P,Q,X, and Y has two attributes: s is a synthesized attribute, and i is an inherited attribute. Consider the following rules.Rule 1: P.i=A.i+2, Q.i=P.i+A.i, and A.s=P.s+Q.sRule 2: X.i=A.i+Y.s and Y.i=X.s+A.iWhich one of the following is TRUE?Q7.
Consider the following intermediate program in three address code p= a -b q= p *c p= u * v q= p + q Which one of the following corresponds to a static single assignment form of the above code?Q9.
Consider the following code segment. x =u-t; y =x*v; x =y+w; y =t-z; y =x*y; The minimum number of total variables required to convert the above code segment to static single assignment form is__________ .Q10.
The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r / 3 + s - t * 5 + u * v /w is _______________.